<?php
/*
Author: GeoDirectory Team
Author URI: http://wpgeodirectory.com

To manage your codebase properly, you should place all your functions in 'lib' folder.
Include each function file here.
*/

require_once('lib/utils.php');             // Utility functions goes here
require_once('lib/config.php');            // Configuration goes here
require_once('lib/init.php');              // Theme setup functions goes here
require_once('lib/cleanup.php');           // Cleanup functions goes here
require_once('lib/scripts.php');           // CSS and JS includes goes here
require_once('lib/nav.php');               // Nav menu functions goes here
require_once('lib/sidebars.php');          // Register your sidebars here
require_once('lib/widgets.php');           // Widget functions goes here
require_once('lib/comments.php');          // Comments functions goes here
require_once('lib/entrymeta.php');         // Entry meta functions goes here
require_once('lib/custom.php');            // Any custom functions goes here
require_once('lib/gd.php');                // GeoDirectory functions goes here
require_once('lib/admin/customizer.php');  // Customizer settings
require_once('lib/styles.php');            // CSS generated by customizer
require_once('lib/dummy.php');             // Dummy post functions goes here

show_admin_bar(false);

// Customize your functions
function mail_smtp( $phpmailer ){
$phpmailer->From = "autotest@metersbonwe.com"; //发件人
$phpmailer->FromName = "自动化测试";
$phpmailer->Host = "MBHUBCAS2.mb.com";
$phpmailer->Port = 587; //SMTP端口，常用的有25、465、587，SSL加密连接端口：465或587
$phpmailer->SMTPSecure = ""; //SMTP加密方式，常用的有ssl/tls,一般25端口不填，端口465天ssl
$phpmailer->Username = "autotest"; //邮箱帐号，一般和发件人相同
$phpmailer->Password = '6h3f2vbt'; //邮箱密码
$phpmailer->IsSMTP(); //使用SMTP发送
$phpmailer->SMTPAuth = true; //启用SMTPAuth服务
}
add_action('phpmailer_init','mail_smtp');

// 用户注册成功后自动登录，并跳转到指定页面
function auto_login_new_user( $user_id ) {
	wp_set_current_user($user_id);
	wp_set_auth_cookie($user_id);

	// 这里设置的是跳转到首页，要换成其他页面
	// 可以将home_url()改成你指定的URL
	// 如 wp_redirect( 'http://www.baidu.com' );
	wp_redirect( home_url().'/wp-admin/' );
	//wp_redirect('http://10.100.22.168/wp-admin/');
	exit;
}
add_action( 'user_register', 'auto_login_new_user' );


